package com.lg.hack;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class FromDexFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        FrameLayout frameLayout = new FrameLayout(container.getContext());
        frameLayout.setBackgroundColor(0xff00ff00);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        frameLayout.setLayoutParams(params);

        ScrollView scrollView = new ScrollView(container.getContext());
        FrameLayout.LayoutParams scrollViewParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
        scrollView.setLayoutParams(scrollViewParams);

        LinearLayout linearLayout = new LinearLayout(container.getContext());
        linearLayout.setOrientation(LinearLayout.VERTICAL);
        FrameLayout.LayoutParams linearLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
        linearLayout.setLayoutParams(linearLayoutParams);


        for (int i = 0; i < 150; i++) {
            TextView textView = new TextView(container.getContext());
            LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
            textView.setLayoutParams(textViewParams);
            textView.setPadding(50, 50, 50, 50);
            textView.setTextColor(0xffffffff);
            textView.setTextSize(40);
            textView.setText("文本" + (i + 1));
            linearLayout.addView(textView);
        }
        scrollView.addView(linearLayout);
        frameLayout.addView(scrollView);
        return frameLayout;
    }
}
